﻿/// <reference path="../Scripts/_references.js" />
$(document).ready(function () {

    $('#Jornadas').change(function () {
        var jornada_id = $(this).val();
        $.getJSON('/Classificacao/GetRank', { idjornada: jornada_id }, function (data) {
            var tblrows = $('#tblRank').find('tr:gt(0)');
            tblrows.remove().fadeOut(2000);           

            //if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
            //    alert('You are using a mobile device!');
            //    return;
            //}

            $.each(data, function (i, item) {
                var row = '<tr><td class="sup">' + (i + 1) + '</td><td class="helpBod">' + item.User.UserName + '</td><td class="helpBod">' + item.W + '</td><td class="helpBod">'
                + item.D + '</td><td class="helpBod">' + item.L + '</td><td class="helpBod">' + item.GF + '</td><td class="helpBod">'
                + item.GA + '</td><td class="helpBod" style="font-weight:bold">' + item.Score + '</td></tr>';
                $(row).appendTo('#tblRank');
            });
            tblrows.fadeIn(2000);
        })
    });
});